<%@ page language="java" import="java.util.*,StudentScore.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>按名字查找学生</title>
</head>
<body>
<form name="postForm" action="findStudent.jsp" method="post">
 <%
    	StudentDao sdao = new StudentDaoJDBC();
    	request.setCharacterEncoding("UTF-8");
    	String name = request.getParameter("姓名");
    	out.println("获得的姓名为"+name);
    	List<Student> students = sdao.findByName(name);
    	
    	//List<User> users = UserDao.getUsersByName(name);
    	if (students.size()!= 0){
    			
    %>
      	<table width="200" border="5" >
	  	<tr>
	    	<td align=center>姓名</td>
	    	<td align=center>学号</td>
	    	<td align=center>数学</td>
	    	<td align=center>Java</td>
	    	<td align=center>体育</td>
	  	</tr>
    	<%	for(int i = 0; i < students.size(); i++){
    			Student stu = students.get(i); %>
    	<tr>
    		<td align=center><%=stu.getName() %></td>
    		<td align=center><%=stu.getStuno() %></td>
    		<td align=center><%=stu.getMath() %></td>
    		<td align=center><%=stu.getJava()%></td>
    		<td align=center><%=stu.getSport()%></td>
    	</tr>
    	<%	}
    	}else{
    		out.println("没找到包含 "+name+" 的学生");	
    	}
     %>  
     </table>
     <input type="submit" value="MENU" />
</form>
</body>
</html>